当前位置: 首页 >  帮助中心> electron 升级chrome(BILLY ELECTRON)

electron 升级chrome(BILLY ELECTRON)

硬件: Windows系统 版本: 485.0.9943.485 大小: 55.55MB 语言: 简体中文 评分: 发布: 2014-02-55 更新: 2024-08-29 厂商: 谷歌信息技术

硬件:Windows系统 版本:485.0.9943.485 大小:55.55MB 厂商: 谷歌信息技术 发布:2014-02-55 更新:2024-08-29

硬件:Windows系统 版本:485.0.9943.485 大小:55.55MB 厂商:谷歌信息技术 发布:2014-02-55 更新:2024-08-29

苹果下载

跳转至官网

electron 升级chrome.

Electron 是一个基于 Node.js 的跨平台桌面应用程序开发框架,它允许开发者使用 Web 技术(HTML、CSS、JavaScript)来构建桌面应用程序。Electron

内置了一个默认的浏览器内核,但是有时候我们可能需要升级 Electron 中的默认浏览器内核,比如从 Chrome 内核升级到 Firefox 内核等。本文将详细介绍如何升级 Electron

中的默认浏览器内核。

我们需要了解的是,Electron 中的默认浏览器内核是由 Electron 本身提供的,而不是由操作系统提供的。我们无法直接在操作系统中升级浏览器内核,而是需要通过修改 Electron

源代码来实现。

下面是一个简单的步骤,介绍如何升级 Electron 中的默认浏览器内核:

1. 克隆 Electron 的源代码

```bash

cd ~

npm install electron-builder --save-dev

cd node_modules/electron-builder

cd src/index.js

cd ../../

git clone https://github.com/electron/electron.git

```

2. 安装所需的依赖项

```bash

npm install --save-dev electron-chromedriver-manager electron-reload electron-safe-console-log

```

3. 在 `package.json` 文件中添加新的配置项

```json

\"scripts\": {\"build\": \"electron-builder\", "reload\": \"electron-reload\"}

\"build\" : {

\"appId\" : \"com.example.myapp\", // your app id here

\"productName\" : \"MyApp\", // your product name here

\"directories\" : {

\"output\" : \"dist\", // output directory for built app

"buildResources\" : \"public\" // build resources directory for built app

},

\"win\" : {

\"target\" : [\"nsis\"]

},

\"mac\" : {

\"target\" : [\"dmg\"]

},

\"linux\" : {

\"target\" : [\"AppImage\"]

},

\"publish\" : {

\"provider\" : \"generic\", // or specific type (e.g. \"google-play-market\")

\"url\" : \"http://localhost:4200/\", // url to publish to (default is http://localhost:4200)

\"autoLaunch\" : true, // auto launch after publishing (default is false)

"apiKey\" : null, // google api key (only for google play market)

\"developerKey\" : null, // in Appcelerator cloud only (not needed for generic provider)

\"buildDir\" : \"build\", // build directory for published app (default is build/distribution)

\"outDir\" : \"out\", // output directory for published app (default is out/release)

\"downloadURL\" : null, // URL to use as download link (default is none)

\"icon\" : null, // path to icon file (default is none)

"pricingMap\" : {}, // pricing map (default is {})

\"ratingsMap\" : {}, // ratings map (default is {})

"win\": {\"targetVersion\": [9]), // Windows version(s) to target (\"[9]\" = all versions)

\\t\\t\\t\t\\t\\t\\t\t\\t\\t\\t\t\\t\\t\\t\t\\t\\t\\\\'version': '10'}

}, \"plugins\": {

\"electron-chromedriver-manager\": {

\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\\'executablePath': 'path/to/chromedriver', // path to chromedriver executable (required)

\\t\\t\t\\t\\t\\t\t\\t\\t\\t\t\\t\\t\\t\\\'version': 'latest', // version of chromedriver to use (latest by default)

\\t\t\\t\\\\'args': ['--headless'] // additional arguments for chromedriver (optional)

}

}, \"extraResources": {

\\t\\\\'webPreferences': {

\t\\\\'nodeIntegration': true, // enable native node integration (requires restart after changes)

\\t\\\\'contextIsolation': false, // disable context isolation (requires restart after changes)

\\t\\\\'preload': [\"path/to/preload.js\"], // preload JavaScript file before creating browser window (optional)

\\t\\\'sandbox': false, // disable sandboxing (requires restart after changes)

\\t\\\\'enableRemoteModule': true, // enable remote module loading from the same host (required for some APIs)

\\t\\\\'worldSafeExecuteJavaScript': true, // allow running the script set by '--allow-running-insecure-content' flag (required for some APIs)

\\t\\\\'webSecurity': false // disable web security (requires restart after changes)

}\

}

}

```

4. 在 `package.json` 文件中添加新的脚本命令

```json

\"{}\"

```


返回顶部